﻿Public Class frmAccountManageBR

    Private EmpData As Employee
    Sub New()

        ' This call is required by the designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.
        EmpData = MainGlobalData.mEmployee
    End Sub

    Private Sub frmAccountManageBR_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        txtUsername.Text = EmpData.username

    End Sub

    Private Sub btnUpdateAccount_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdateAccount.Click

        If txtUsername.Text.Count <= 0 OrElse Not txtPassword.Text = txtConfirmPassword.Text OrElse txtPassword.Text.Count <= 0 OrElse txtConfirmPassword.Text.Count <= 0 Then
            lblFail.Visible = True
            lblSuccess.Visible = False
            txtConfirmPassword.Text = ""
            txtPassword.Text = ""
        Else
            lblFail.Visible = False
            lblSuccess.Visible = True

            EmpData.username = txtUsername.Text
            EmpData.password = txtPassword.Text
        End If

        Dim empMgr As New EmployeeManager
        empMgr.updateEmployee(EmpData)

        MainGlobalData.mEmployee = EmpData
    End Sub
End Class